#ifndef RESOURCEMANAGER_H
#define RESOURCEMANAGER_H

#include <QMap>
#include <QString>
#include "shader.h"
#include "texture2d.h"

class ResourceManager
{
public:
    static Shader *loadShader(const QString &name,
                              const QString &vShaderFile,
                              const QString &fShaderFile,
                              const QString &gShaderfile = nullptr);
    static Shader *getShader(const QString &name);

    static Texture2D *loadTexture(const QString &name,
                                  const QString &file,
                                  GLboolean alpha = GL_FALSE);
    static Texture2D *getTexture(const QString &name);

    static void clear();

private:
    static QMap<QString, Shader *> shaderMap;
    static QMap<QString, Texture2D *> textureMap;

private:
    ResourceManager() {} //虚函数，不要对象，只是用静态方法
};

#endif // RESOURCEMANAGER_H
